﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using YSC_Backstage_Web.Models;
using YSC_Backstage_Web.RestClient;
using YSC_Services.BLL.Services.Interfaces;

namespace YSC_Backstage_Web.Controllers
{
    /// <summary>
    /// 首页
    /// </summary>  
    public class HomeController : Controller
    {
        private IUserBackstageServices _rep;

        public HomeController(IUserBackstageServices rep)
        {
            this._rep = rep;
        }
      
        public IActionResult Index()
        {
            return View();
        }
        public IActionResult Privacy()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }

        /// <summary>
        /// 用户菜单
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public JsonResult UserMenu(string roleId)
        {
            var ret = _rep.UserMenu(roleId);
            return Json(ret);
        }
    }
}
